package com.flexcodejam.vfd.business {
	
	import mx.rpc.IResponder;
	import com.adobe.cairngorm.business.ServiceLocator;
	import mx.rpc.events.FaultEvent;
	import mx.rpc.events.ResultEvent;
	import com.flexcodejam.vfd.vo.User;
	import com.flexcodejam.vfd.vo.FoodDrive;

	public class UserDelegate
	{
		private var responder : IResponder;
		private var service : Object;
		
		public function UserDelegate( responder : IResponder )
		{		
			this.service = ServiceLocator.getInstance().getRemoteObject("UserService" );
			this.responder = responder;
		}
		
		public function LoginUser(user:User): void
		{	
			var call : Object = service.Login(user);
			call.addResponder( responder );
		}	
		
		public function SaveUser(user:User): void
		{	

			var call : Object = service.saveUser(user);
			call.addResponder( responder );
		}	

		public function GetAllUsers(user:User): void
		{	
			var call : Object = service.GetAllUsers(user);
			call.addResponder( responder );
		}			
		
		public function getUserByFoodDriveId(foodDrive:FoodDrive):void
		{
			var call : Object = service.GetUserByFoodDriveId(foodDrive.ID);
			call.addResponder( responder );
		}		
	
		public function getTotalDonationsByUserID(foodDrive:FoodDrive):void
		{
			var call : Object = service.getTotalDonationsByUserID(foodDrive.ID);
			call.addResponder( responder );
		}		
	
	}

}